using System;
using System.Text;
namespace ICSharpCode.SharpZipLib.Zip
{
	public sealed class ZipConstants
	{
		public const int VersionMadeBy = 51;
		[Obsolete("Use VersionMadeBy instead")]
		public const int VERSION_MADE_BY = 51;
		public const int VersionStrongEncryption = 50;
		[Obsolete("Use VersionStrongEncryption instead")]
		public const int VERSION_STRONG_ENCRYPTION = 50;
		public const int VERSION_AES = 51;
		public const int VersionZip64 = 45;
		public const int LocalHeaderBaseSize = 30;
		[Obsolete("Use LocalHeaderBaseSize instead")]
		public const int LOCHDR = 30;
		public const int Zip64DataDescriptorSize = 24;
		public const int DataDescriptorSize = 16;
		[Obsolete("Use DataDescriptorSize instead")]
		public const int EXTHDR = 16;
		public const int CentralHeaderBaseSize = 46;
		[Obsolete("Use CentralHeaderBaseSize instead")]
		public const int CENHDR = 46;
		public const int EndOfCentralRecordBaseSize = 22;
		[Obsolete("Use EndOfCentralRecordBaseSize instead")]
		public const int ENDHDR = 22;
		public const int CryptoHeaderSize = 12;
		[Obsolete("Use CryptoHeaderSize instead")]
		public const int CRYPTO_HEADER_SIZE = 12;
		public const int LocalHeaderSignature = 67324752;
		[Obsolete("Use LocalHeaderSignature instead")]
		public const int LOCSIG = 67324752;
		public const int SpanningSignature = 134695760;
		[Obsolete("Use SpanningSignature instead")]
		public const int SPANNINGSIG = 134695760;
		public const int SpanningTempSignature = 808471376;
		[Obsolete("Use SpanningTempSignature instead")]
		public const int SPANTEMPSIG = 808471376;
		public const int DataDescriptorSignature = 134695760;
		[Obsolete("Use DataDescriptorSignature instead")]
		public const int EXTSIG = 134695760;
		[Obsolete("Use CentralHeaderSignature instead")]
		public const int CENSIG = 33639248;
		public const int CentralHeaderSignature = 33639248;
		public const int Zip64CentralFileHeaderSignature = 101075792;
		[Obsolete("Use Zip64CentralFileHeaderSignature instead")]
		public const int CENSIG64 = 101075792;
		public const int Zip64CentralDirLocatorSignature = 117853008;
		public const int ArchiveExtraDataSignature = 117853008;
		public const int CentralHeaderDigitalSignature = 84233040;
		[Obsolete("Use CentralHeaderDigitalSignaure instead")]
		public const int CENDIGITALSIG = 84233040;
		public const int EndOfCentralDirectorySignature = 101010256;
		[Obsolete("Use EndOfCentralDirectorySignature instead")]
		public const int ENDSIG = 101010256;
		private static string defaultCodePage = Encoding.get_UTF8().get_WebName();
		public static string DefaultCodePage
		{
			get
			{
				return ZipConstants.defaultCodePage;
			}
			set
			{
				ZipConstants.defaultCodePage = value;
			}
		}
		public static string ConvertToString(byte[] data, int count)
		{
			string result;
			if (data == null)
			{
				result = string.Empty;
			}
			else
			{
				result = Encoding.GetEncoding(ZipConstants.DefaultCodePage).GetString(data, 0, count);
			}
			return result;
		}
		public static string ConvertToString(byte[] data)
		{
			string result;
			if (data == null)
			{
				result = string.Empty;
			}
			else
			{
				result = ZipConstants.ConvertToString(data, data.Length);
			}
			return result;
		}
		public static string ConvertToStringExt(int flags, byte[] data, int count)
		{
			string result;
			if (data == null)
			{
				result = string.Empty;
			}
			else
			{
				if ((flags & 2048) != 0)
				{
					result = Encoding.get_UTF8().GetString(data, 0, count);
				}
				else
				{
					result = ZipConstants.ConvertToString(data, count);
				}
			}
			return result;
		}
		public static string ConvertToStringExt(int flags, byte[] data)
		{
			string result;
			if (data == null)
			{
				result = string.Empty;
			}
			else
			{
				if ((flags & 2048) != 0)
				{
					result = Encoding.get_UTF8().GetString(data, 0, data.Length);
				}
				else
				{
					result = ZipConstants.ConvertToString(data, data.Length);
				}
			}
			return result;
		}
		public static byte[] ConvertToArray(string string_0)
		{
			byte[] result;
			if (string_0 == null)
			{
				result = new byte[0];
			}
			else
			{
				result = Encoding.GetEncoding(ZipConstants.DefaultCodePage).GetBytes(string_0);
			}
			return result;
		}
		public static byte[] ConvertToArray(int flags, string string_0)
		{
			byte[] result;
			if (string_0 == null)
			{
				result = new byte[0];
			}
			else
			{
				if ((flags & 2048) != 0)
				{
					result = Encoding.get_UTF8().GetBytes(string_0);
				}
				else
				{
					result = ZipConstants.ConvertToArray(string_0);
				}
			}
			return result;
		}
		private ZipConstants()
		{
		}
	}
}
